package com.scpii.api.persistence.user;

import java.util.List;

import org.apache.ibatis.annotations.Param;

import com.scpii.api.domain.user.UserActions;

public interface UserActionsMapper {
	int deleteByPrimaryKey(Long id);

	int insert(UserActions record);

	int insertSelective(UserActions record);

	UserActions selectByPrimaryKey(Long id);

	int updateByPrimaryKeySelective(UserActions record);

	int updateByPrimaryKey(UserActions record);

	List<UserActions> selectBySelective(UserActions userActions);

	List<UserActions> selectBySelectiveWithSingle(UserActions userActions);

	List<UserActions> selectUserStatusByTargetAndActionTypes(
			@Param("userId") Long userId, @Param("targetId") Long targetId,
			@Param("types") String[] types);

	/**
	 * @param targetId
	 * @param actionTypes
	 * @return
	 */
	List<UserActions> selectByTargetAndActionTypes(
			@Param("targetId") Long targetId,
			@Param("actionTypes") String[] actionTypes);

	/**
	 * @param table
	 * @param id
	 * @param column
	 * @param count
	 * @return
	 */
	void updateTableCountByColoumAndId(@Param("tableName") String table,
			@Param("id") Long id, @Param("columnName") String columnName,
			@Param("idName") String idName, @Param("count") Integer count);

	/**
	 * @param userId
	 * @param actionType
	 * @return
	 */
	Integer selectCountByUserIdAndType(@Param("userId") Long userId,
			@Param("actionType") String actionType);

	/**
	 * @param record
	 * @param actionTypes
	 */
	void deleteByWithInTypes(@Param("record") UserActions record,
			@Param("actionTypes") String[] actionTypes);

	/**
	 * @param userId
	 * @param actionType
	 * @return
	 */
	List<UserActions> selectByUserIdAndActionType(@Param("userId") Long userId,
			@Param("actionTypes") String[] actionTypes);

}